/**
 * Copyright (c) 2018-2019 PoleStar Studio. All Rights Reserved. <br>
 * Use is subject to license terms.<br>
 * <p>
 * 在此处填写文件说明
 */
package assemble_xml;

import assemble_xml.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

/**
 * bean的装配测试类.
 * <p>说明.<br>
 *     1.基于xml的装配
 * @version v1.0
 * @author lianzuozheng
 * @date 2019-03-21 -18:00 
 */
public class Test {

    public static void main(String[] args) {
        // 指定Spring配置文件路径
        String xmlPath= "assemble_xml/beans.xml";
        // 创建Spring容器
        ApplicationContext ac = new ClassPathXmlApplicationContext(xmlPath);
        // 从容器中获取bean
        Student bean1 = (Student) ac.getBean("student");
        // 使用bean
        System.out.println(bean1.toString());
    }
}
